import React from 'react';
import {Route, Router, Switch} from 'dva/router';
import IndexPage from './routes/IndexPage';
import Home from "./routes/Home/Home";
import Orders from "./routes/Order/Orders";
import Foods from "./routes/Food/Foods";
import Classes from "./routes/Class/Classes";
import Times from "./routes/Time/Times";
import Qrcode from "./routes/Qrcode/Qrcode";

function RouterConfig({history}) {
  return (
    <Router history={history}>
      <Switch>
        <Route path="/"
               component={(props) =>
                 <IndexPage {...props}>
                   <Switch>
                     <Route path="/home" exact component={Home}/>
                     <Route path="/orders" exact component={Orders}/>
                     <Route path="/foods" exact component={Foods}/>
                     <Route path="/class" exact component={Classes}/>
                     <Route path="/times" exact component={Times}/>
                     <Route path="/qrcode" exact component={Qrcode}/>
                   </Switch>
                 </IndexPage>
               }
        />
      </Switch>
    </Router>
);
}

export default RouterConfig;
